/**
 * author      : dormi330
 * date        : 2018/7/2
 * project     : mybatis
 * description : TODO
 */

package com.deep.trade.adaptor.required.inventory;

import java.util.ArrayList;
import java.util.List;

public class DtoAssureInventory {

    public static class SkuAndQuanlity {
        private String skuId;
        private int quantity;

        public SkuAndQuanlity(String skuId, int quantity) {
            this.skuId = skuId;
            this.quantity = quantity;
        }

        public String getSkuId() {
            return skuId;
        }
        public void setSkuId(String skuId) {
            this.skuId = skuId;
        }
        public int getQuantity() {
            return quantity;
        }
        public void setQuantity(int quantity) {
            this.quantity = quantity;
        }
    }

    private String orderId;                             // 此次减少库存对应的 orderId
    private String reqId;                               // reqid 幂等设计
    private String tenantCode;                          // 租户code
    private List<SkuAndQuanlity> skuAndQuanlityList;    // sku和数量

    public void addItem(String skuId, int quantity) {
        if (skuAndQuanlityList == null) {
            this.skuAndQuanlityList = new ArrayList<>();
        }
        this.skuAndQuanlityList.add(new SkuAndQuanlity(skuId, quantity));
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }


    public String getReqId() {
        return reqId;
    }

    public void setReqId(String reqId) {
        this.reqId = reqId;
    }

    public List<SkuAndQuanlity> getSkuAndQuanlityList() {
        return skuAndQuanlityList;
    }

    public void setSkuAndQuanlityList(List<SkuAndQuanlity> skuAndQuanlityList) {
        this.skuAndQuanlityList = skuAndQuanlityList;
    }

    public String getTenantCode() {
        return tenantCode;
    }

    public void setTenantCode(String tenantCode) {
        this.tenantCode = tenantCode;
    }
}
